Fixes for a number of minor warnings.
authorrobertlipe <robertlipe@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Thu, 13 Feb 2014 01:55:01 +0000 (01:55 +0000)
committerrobertlipe <robertlipe@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Thu, 13 Feb 2014 01:55:01 +0000 (01:55 +0000)
git-svn-id: http://gpsbabel.googlecode.com/svn/trunk@4734 f51c46e8-681c-474f-0cfe-069cfd0219fb

gpsbabel/dg-100.cc
gpsbabel/exif.cc
gpsbabel/gopal.cc
gpsbabel/humminbird.cc
gpsbabel/jeeps/gpsserial.cc
gpsbabel/jeeps/jgpsutil.cc
gpsbabel/mmo.cc
gpsbabel/overlay.cc
gpsbabel/parse.cc
gpsbabel/trackfilter.cc
gpsbabel/util.cc

index 0f1d04cbec62852d2c989f3953f8cf44ccd8ae1e..948c81a6b9db34374b8e373deb5ae228ff417ef9 100644 (file)
@@ -181,11 +181,9 @@ dg100_log(const char* fmt, ...)
 {
   va_list ap;
   va_start(ap, fmt);
-  if (global_opts.debug_level < 1) {
-    return;
+  if (global_opts.debug_level > 0) {
+    vfprintf(stderr, fmt, ap);
   }
-
-  vfprintf(stderr, fmt, ap);
   va_end(ap);
 }
 
index 3615120e65baba69d2e0ea02fea7163c73a7678e..cbb751d55cffd8498f1432e854bafe7b44632b62 100644 (file)
@@ -567,7 +567,6 @@ exif_read_app(exif_app_t* app)
   if (ifd == NULL) {
     return;
   }
-
   if (ifd->next_ifd) {
     ifd = exif_read_ifd(app, IFD1, ifd->next_ifd, &exif_ifd_ofs, &gps_ifd_ofs, &inter_ifd_ofs);
   }
@@ -580,6 +579,9 @@ exif_read_app(exif_app_t* app)
   if (inter_ifd_ofs) {
     ifd = exif_read_ifd(app, 4, inter_ifd_ofs, NULL, NULL, NULL);
   }
+  // The return values of exif_read_ifd above aren't actually used.  
+  // Warning hush.
+  (void) ifd;
 }
 
 static void
index 4b69dd43c31513198c3ee01019159aa93d2706a2..0d42558c40ebda7208472a1879ba26c6e3f7a2ea 100644 (file)
@@ -149,7 +149,7 @@ gopal_rd_init(const char* fname)
       strncpy(&buff[0],&filename[2],8);
     }
     // in buff we should now have something wich looks like a valid date starting with YYYYMMDD
-    ck = (char*)strptime(buff, "%Y%m%d", &filenamedate);
+    /*ck = (char*)*/strptime(buff, "%Y%m%d", &filenamedate);
     // if (((ck == NULL) || (*ck != '\0') )&&!(optdate))
     // fatal(MYNAME ": Invalid date in filename \"%s\", try to set manually using \"date\" switch!\n", buff);
     // /* else */ if (filenamedate.tm_year < 70)
index 836899b053e87117ef0ad774642286d798da28e8..829fba0f9cd66b36905d6b1f87e2bb42d114b406 100644 (file)
@@ -767,7 +767,7 @@ humminbird_track_head(const route_head* trk)
 
 // NEW_STRING: remove speare ctor below.
     name = mkshort(trkname_sh, QString(trk->rte_name));
-    strncpy(trk_head->name, CSTR(name), sizeof(trk_head->name));
+    strncpy(trk_head->name, CSTR(name), sizeof(trk_head->name)-1);
     be_write16(&trk_head->trk_num, trk->rte_num);
   }
 }
index 68c4d028dfca1309a5a3349d528d6961dcace803..19ef8f8fd68cdf8b0fb45f17d2d33799aa8650b6 100644 (file)
@@ -82,6 +82,8 @@ void GPS_Serial_Error(const char* mb, ...)
   FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, 0,
                 GetLastError(), 0, s, sizeof(msg) - b - 2, 0);
   GPS_Error(msg);
+
+  va_end(ap);
 }
 
 int32 GPS_Serial_On(const char* port, gpsdevh** dh)
index a9374c68ad9bd90b487c428ad9890bb7e9df597b..77522243413e3ce226f1d35b289b45d9dd445ff1 100644 (file)
@@ -506,15 +506,12 @@ void GPS_Error(const char* fmt, ...)
   va_list argp;
   va_start(argp, fmt);
 
-  if (!gps_error) {
-    return;
+  if (gps_error) {
+    fprintf(stderr, "[ERROR] ");
+    vfprintf(stderr, fmt, argp);
+    fprintf(stderr, "\n");
   }
 
-
-  fprintf(stderr, "[ERROR] ");
-  vfprintf(stderr, fmt, argp);
-  fprintf(stderr, "\n");
-
   va_end(argp);
   return;
 }
index b99720c476e03a4909ebb16fe266c8a4ea3f719d..17f5c54e8c1390a043ec2fbb1b90ee87f209c392 100644 (file)
@@ -497,10 +497,8 @@ mmo_read_CObjWaypoint(mmo_data_t* data)
     DBG((sobj, "rtelinks = %d\n", rtelinks));
 
     for (i = 0; i < rtelinks; i++) {
-      mmo_data_t* tmp;
-
       DBG((sobj, "read rtelink number %d\n", i + 1));
-      rtelink[i] = tmp = mmo_read_object();
+      rtelink[i] = mmo_read_object();
     }
 
   }
index b0a6b77ce18e92ea60039e2dd2bac6a2d978b887..1338416b5c54dea31011ad1ca5266d5fcb627338 100644 (file)
@@ -268,17 +268,17 @@ static void ovl_read(void)
     }
     lineno++;
     line = lrtrim(line);
-    if ((pstr = strstr(line,"[Symbol "))!= NULL) {
+    if ((strstr(line,"[Symbol "))!= NULL) {
       sym_cnt++;
       isSection = SECTION_SYMBOL;
-    } else if ((pstr = strstr(line,"[Overlay]"))!= NULL) {
+    } else if ((strstr(line,"[Overlay]"))!= NULL) {
       isSection = SECTION_OVERLAY;
     } else if (isSection==SECTION_SYMBOL) {
       pstr = strtok(line,"=");
-      if (pstr!=NULL) {
+      if (pstr != NULL) {
         keyw = isKeyword(pstr,Keywords);
         pstr = strtok(NULL,"\n");
-        if (pstr!=NULL) {
+        if (pstr != NULL) {
           switch (keyw) {
           case KEY_TYP     :
             aktTyp = atoi(pstr);
index 0fec1010570bbf7a150004c1a39011494af3e933..4b056eef6625975efc74bf72285829b3edd4ad2b 100644 (file)
@@ -156,7 +156,7 @@ parse_coordinates(const char* str, int datum, const grid_type grid,
                   double* latitude, double* longitude, const char* module)
 {
   double lat, lon;
-  unsigned char lathemi, lonhemi;
+  unsigned char lathemi=0, lonhemi=0;
   int deg_lat, deg_lon, min_lat, min_lon;
   char map[3];
   int utmz;
index c3729725821808664fade4ec2f4460429f9124c4..1206d90b587a3f5ce7d83a3649959fedcd09e67b 100644 (file)
@@ -388,7 +388,7 @@ trackfilter_fill_track_list_cb(const route_head* track)     /* callback for track_d
 static void
 trackfilter_split_init_rte_name(route_head* track, const QDateTime dt)
 {
-  char buff[128], tbuff[128];
+  char tbuff[128];
   struct tm tm;
 
   time_t time = dt.toUTC().toTime_t();
@@ -398,6 +398,8 @@ trackfilter_split_init_rte_name(route_head* track, const QDateTime dt)
   strftime(tbuff, sizeof(tbuff), "%Y%m%d%H%M%S", &tm) :
   strftime(tbuff, sizeof(tbuff), "%Y%m%d", &tm);
 
+  // TODO: this should be q QString.
+  char buff[128];
   if ((opt_title != NULL) && (strlen(opt_title) > 0)) {
     if (strchr(opt_title, '%') != NULL) {
       strftime(buff, sizeof(buff), opt_title, &tm);
@@ -405,7 +407,7 @@ trackfilter_split_init_rte_name(route_head* track, const QDateTime dt)
       snprintf(buff, sizeof(buff), "%s-%s", opt_title, tbuff);
     }
   } else if (!track->rte_name.isEmpty()) {
-    snprintf(buff, sizeof(buff), "%s-%s", CSTRc(track->rte_name), tbuff);
+    snprintf(buff, sizeof(buff) - 1, "%s-%s", CSTRc(track->rte_name), tbuff);
   } else {
     strncpy(buff, tbuff, sizeof(buff));
   }
index df4b87f4d8674aa8bd5f2254974c04fde964af07..ece38cc0431c345c2af5f9c6848d9cdc8c07c231 100644 (file)
@@ -1089,7 +1089,7 @@ strsub(const char* s, const char* search, const char* replace)
     return NULL;
   }
 
-  d = (char*) xmalloc(len + rlen);
+  d = (char*) xmalloc(len + rlen + 1);
 
   /* Copy first part */
   len = p - s;